/*
 * @Author: NtyAaron
 * @Date: 2021-04-12 14:14:04
 * @LastEditors: NtyAaron
 * @LastEditTime: 2021-06-23 14:24:27
 * @Description: 登录部分api
 * @FilePath: \dwq\api\user\user.js
 */

import request from '../../utils/request'

// 小程序登录
export const login = (e) => {
  return request({
    method: 'POST',
    url: `/user/login?code=${e.code}&encryptedData=${e.encryptedData}&iv=${e.iv}`,
  })
}

// 获取用户详情
export const getUser = (data) => {
  return request({
    url: `/user/getUser`,
    data,
  })
}

// 保存编辑用户
export const saveUser = (data) => {
  return request({
    url: `/user/saveUser`,
    method: 'POST',
    data,
  })
}

// 获取足迹列表
export const getFootprintList = (data) => {
  return request({
    url: `/collect/getFootprintList`,
    data,
  })
}

// 获取用户偏好
export const getPreferenceList = (data) => {
  return request({
    url: `/user/getPreferenceList`,
    data,
  })
}

// 新增/编辑/删除用户偏好
export const savePreference = (data) => {
  return request({
    url: `/user/savePreference`,
    data,
  })
}

// 切换语言
export const saveUserLanguage = (data) => {
  return request({
    url: `/user/saveUserLanguage`,
    data,
  })
}

// 修改用户权限
export const savePower = (data) => {
  return request({
    method: 'post',
    url: `/user/savePower`,
    data,
  })
}

// 查看用户权限
export const getPower = (data) => {
  return request({
    url: `/user/getPower`,
    data,
  })
}

// 删除足迹
export const delFootprint = (data) => {
  return request({
    url: `/collect/delFootprint`,
    data,
  })
}
